package com.github.sub.inter;

import com.github.Common;

import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static com.github.MyAutoTestContext.BLANK;
import static com.github.MyAutoTestContext.DBLANK;

public class AliasCommander extends Common implements com.github.Commander {

    @Override
    public Object run(Map<String, String> command) {
        String value = command.get("-a");
        String[] keyValue = value.split(DBLANK);
        List<String> collect = Arrays.stream(keyValue).collect(Collectors.toList());
        String interName = collect.get(0);
        if (!new File(interfaceName + File.separator +interName.hashCode()).exists()) {
            tradition.outPutFile(interName.getBytes(), interfaceName, interName.hashCode() + BLANK);
        }
        tradition.outPutFile(interName.getBytes(), alias, collect.get(1));
        return null;
    }
}
